import { themeStore } from '@/stores/index'
import { onShow } from '@dcloudio/uni-app'
import { storeToRefs } from 'pinia'

export function useTheme() {
    // 被组合式函数封装和管理的状态
    const theme = themeStore();
    const { themeClass } = storeToRefs(theme)
    const { setNavigationBarColorHandler } = theme
    onShow(() => {
        setNavigationBarColorHandler()
    })

    // 通过返回值暴露所管理的状态
    return {
        themeClass
    }
}